/**
 * Copyright (c) 2018  All rights reserved.
 */

package com.qzsoft;

import com.qzsoft.zhjd.laboratory.modules.asphaltPenetrometer.service.impl.AsphaltPenetrometerServiceImpl;
import com.qzsoft.zhjd.laboratory.modules.asphaltPenetrometer.service.impl.PenetrometerServer;
import com.qzsoft.zhjd.laboratory.modules.asphaltSofteningPoint.service.impl.AsphaltSofteningPointServiceImpl;
import com.qzsoft.zhjd.laboratory.modules.asphaltSofteningPoint.service.impl.SoftPointServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 *
 * @author
 */
@EnableScheduling
@EnableAsync //打开异步
@EnableCaching  //打开缓存
@SpringBootApplication(exclude = {
		org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class},
scanBasePackages = {"com.qzsoft", "cn.qzsoft"})
@ComponentScan(excludeFilters = {
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = com.qzsoft.jeemis.platform.security.config.WebMvcConfig.class),
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = com.qzsoft.jeemis.common.config.SwaggerConfig.class),
        @ComponentScan.Filter(type = FilterType.REGEX, pattern = "com.qzsoft.jeemis.platform.message.*"),
        @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = com.qzsoft.jeemis.platform.security.config.ShiroConfig.class)
})
public class AdminApplication extends SpringBootServletInitializer {

	@Autowired
	private AsphaltPenetrometerServiceImpl penetrometerService;
	@Autowired
	private AsphaltSofteningPointServiceImpl softeningPointService;

	public static void main(String[] args) {
		SpringApplication.run(AdminApplication.class, args);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(AdminApplication.class);
	}

	@Bean
	public CommandLineRunner startServer() {
		return args -> {
//			//二标针入度
//			PenetrometerServer server = new PenetrometerServer(penetrometerService);
//			new Thread(server::startServer).start();
//			//二标软化点
//			SoftPointServer softPointServer = new SoftPointServer(softeningPointService);
//			new Thread(softPointServer::startServer).start();

		};
	}

}
